# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Math-Calculus-FixedPoint.t'

use Test::More tests => 2;
BEGIN { use_ok('Math::Calculus::FixedPoint') };

my ( $exp, $var ) = ( 'x^2 + x - 6', 'x' );
diag( "\nExpression: " . $exp );

my $equiv_exp = '(6 - x)^1/2';
diag( "\nEquivalent expression: " . $equiv_exp );

my $expected = 1.99999999999999;
diag( "Expected: x=" . $expected );

my $fixPoint = Math::Calculus::FixedPoint->new(
    expression => $exp,
    equiv_exp  => $equiv_exp,
    variable   => $var,
    start      => 1,
    precision  => 13
);
my $got = $fixPoint->run;
diag( "Got: x=" . $got );

cmp_ok( sprintf( "%.14f", $got ), '==', $expected, 'fixed point run with expression: x^2 + x - 6');

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

